# 创建一个栈
'''
Stack() 创建一个新的空栈
push(item) 添加一个新的元素item到栈顶
pop() 弹出栈顶元素
peek() 返回栈顶元素
is_empty() 判断栈是否为空
size() 返回栈的元素个数
'''
class Stack():
    def __init__(self):
        self.__stack = []
    def Push(self,value):
        self.__stack.append(value)
    def pop(self):
        self.__stack.pop()
    def peek(self):
        return self.__stack[len(self.__stack)-1]
    def is_empty(self):
        return self.__stack == []
    def size(self):
        return (len(self.__stack))

if __name__== "__main__":
    mystack =Stack()
    print(mystack.is_empty())
    mystack.Push(3)
    mystack.Push(4)
    mystack.Push(5)
    print(mystack.is_empty())
    mystack.Push(6)
    mystack.Push(7)
    mystack.pop()
    print(mystack.peek())
    print(mystack.size())

